{% load engine_tags %}
{% load static %}

<div  class="ui top attached horizontal menu">
    <a class="ui {% activate active "home" %} item" href="{% url 'index' %}">
          <i class="home icon"></i> Home
    </a>

    <a class="item {% activate active "project_list" %}" href="{% url 'project_list' %}">
        <i class="list icon"></i><span class="phone">Project List</span>
    </a>
    <a class="{% activate active "latest_recipes" %} item" href="{% url 'latest_recipes' %}">
        <i class="settings icon"></i>Latest Recipes
    </a>

    {% if user.is_authenticated %}

        <div class="ui simple dropdown item">

            Actions <i class="dropdown icon"></i>
            <div class="menu">

                <a class="ui item" href="{% url 'project_create' %}">
                    <i class="circle plus icon"></i>New Project
                </a>

                {% if project and project|writable:user %}
                    <a class="item" href="{% url 'recipe_create' project.uid %}">
                        <i class="settings icon"></i>Create Recipe
                    </a>

                    <a class="item" href="{% url 'data_upload' project.uid %}">
                        <i class="folder open icon"></i>Upload Data
                    </a>

                {% endif %}

                {% if user.is_superuser %}

                    <a class="ui item" href="{% url 'root_list' %}">
                        <i class="download  icon"></i>Import Data
                    </a>

                    <a class="ui item" href="{% url 'site_admin' %}">
                        <i class="dashboard icon"></i>Site Admin
                    </a>

                {% endif %}


            </div>

        </div>


    {% endif %}


    <div class="ui category search fluid item">
        <div class="ui transparent icon input">
            <input class="prompt"  type="text" id="recipe-search" placeholder="Search recipes...">
            <i class="search link icon" style="padding-right: 20px;"></i>
        </div>
    </div>

    <div class="right menu">


        {% if user.is_authenticated %}
            <a class="{% activate "profile" tab %} {% if user.is_superuser %}trusted{% endif %} item"
               href="{% url "user_profile" user.profile.uid %}">

                {% if user.is_superuser %}
                    <i class="user md icon"></i>
                {% elif user.profile.trusted %}
                    <i class="user plus icon"></i>
                {% else %}
                    <i class="user outline icon"></i>
                {% endif %}

                <span class="widescreen">{{ user.profile.name }}</span>
            </a>


            <a class="{% activate "logout" active %} item" href="{% url 'logout' %}">
                <i class="sign out icon"></i><span class="widescreen">Logout</span>
            </a>
            <a class="{% activate "bin" active %} item" href="{% url 'recycle_bin' %}">
                <i class="trash icon"></i>
            </a>

        {% else %}

            <a class="{% activate "login" active %} item" href="{% url 'login' %}">
                <i class="sign in icon"></i>Login
            </a>

        {% endif %}

        <a class="item widescreen" target="_blank" href="https://bioinformatics-recipes.readthedocs.io/">
            <i class="question circle icon"></i>
        </a>

    </div>

</div>

